package chenji.moreitemfunapi.util;

import java.util.EnumSet;
import java.util.Set;

import org.bukkit.Material;

import com.google.common.collect.Sets;

@SuppressWarnings("deprecation")
public class ItemUtil {
	private static final Set<Integer> armors_id = Sets.newHashSet();
	private static final Set<Material> armors = EnumSet.of(Material.CHAINMAIL_LEGGINGS, Material.DIAMOND_LEGGINGS, Material.GOLD_LEGGINGS, Material.IRON_LEGGINGS, Material.LEATHER_LEGGINGS,
			Material.LEATHER_HELMET, Material.DIAMOND_HELMET, Material.GOLD_HELMET, Material.IRON_HELMET, Material.CHAINMAIL_HELMET, Material.CHAINMAIL_BOOTS, Material.DIAMOND_BOOTS,
			Material.GOLD_BOOTS, Material.IRON_BOOTS, Material.LEATHER_BOOTS, Material.CHAINMAIL_CHESTPLATE, Material.DIAMOND_CHESTPLATE, Material.GOLD_CHESTPLATE, Material.IRON_CHESTPLATE,
			Material.LEATHER_CHESTPLATE);
	private static final Set<Material> chain_armors = EnumSet.of(Material.CHAINMAIL_BOOTS, Material.CHAINMAIL_CHESTPLATE, Material.CHAINMAIL_HELMET, Material.CHAINMAIL_LEGGINGS);
	private static final Set<Material> diamond_armors = EnumSet.of(Material.DIAMOND_BOOTS, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_HELMET, Material.DIAMOND_LEGGINGS);
	private static final Set<Material> gold_armors = EnumSet.of(Material.GOLD_BOOTS, Material.GOLD_CHESTPLATE, Material.GOLD_HELMET, Material.GOLD_LEGGINGS);
	private static final Set<Material> iron_armors = EnumSet.of(Material.IRON_BOOTS, Material.IRON_CHESTPLATE, Material.IRON_HELMET, Material.IRON_LEGGINGS);
	private static final Set<Material> leather_armors = EnumSet.of(Material.LEATHER_BOOTS, Material.LEATHER_CHESTPLATE, Material.LEATHER_HELMET, Material.LEATHER_LEGGINGS);
	static {
		// Leggings
		armors_id.add(Material.CHAINMAIL_LEGGINGS.getId());
		armors_id.add(Material.DIAMOND_LEGGINGS.getId());
		armors_id.add(Material.GOLD_LEGGINGS.getId());
		armors_id.add(Material.IRON_LEGGINGS.getId());
		armors_id.add(Material.LEATHER_LEGGINGS.getId());
		// Helmet
		armors_id.add(Material.LEATHER_HELMET.getId());
		armors_id.add(Material.DIAMOND_HELMET.getId());
		armors_id.add(Material.GOLD_HELMET.getId());
		armors_id.add(Material.IRON_HELMET.getId());
		armors_id.add(Material.CHAINMAIL_HELMET.getId());
		// boot
		armors_id.add(Material.CHAINMAIL_BOOTS.getId());
		armors_id.add(Material.DIAMOND_BOOTS.getId());
		armors_id.add(Material.GOLD_BOOTS.getId());
		armors_id.add(Material.IRON_BOOTS.getId());
		armors_id.add(Material.LEATHER_BOOTS.getId());
		// che
		armors_id.add(Material.CHAINMAIL_CHESTPLATE.getId());
		armors_id.add(Material.DIAMOND_CHESTPLATE.getId());
		armors_id.add(Material.GOLD_CHESTPLATE.getId());
		armors_id.add(Material.IRON_CHESTPLATE.getId());
		armors_id.add(Material.LEATHER_CHESTPLATE.getId());
	}

	public static boolean isChainArmor(Material material) {
		return chain_armors.contains(material);
	}

	public static boolean isDiamondArmor(Material material) {
		return diamond_armors.contains(material);
	}

	public static boolean isgoldArmor(Material material) {
		return gold_armors.contains(material);
	}

	public static boolean isIronArmor(Material material) {
		return iron_armors.contains(material);
	}

	public static boolean isLeatherArmor(Material material) {
		return leather_armors.contains(material);
	}

	public static boolean isArmor(int id) {
		return armors_id.contains(id);
	}

	public static boolean isArmor(Material material) {
		return armors.contains(material);
	}

}
